<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

  <h:head>


</h:head>

<h:body>
	<h:form id="form1">

		<p:panel header="Finalizar Compra">

			<p:dataTable value="#{mbCliente.lista}" var="produtos" id="carrinho">


				<p:column headerText="Preço">
					<p:outputLabel value="#{produtos.preco}">
						<f:convertNumber type="currency" />
					</p:outputLabel>
				</p:column>

				<p:column headerText="Imagem">
					<p:graphicImage value="imagem/#{produtos.imagem}"
						style="width:50px" />
				</p:column>
			</p:dataTable>
			<p:panelGrid>
				<p:outputLabel value="Valor Total" />
				<p:outputLabel value="#{mbCliente.total}">
					<f:convertNumber type="currency" />

				</p:outputLabel>


			</p:panelGrid>
			<br />

			<p:tabView>

				<p:tab title="Dados do Cliente">

					<p:panelGrid columns="2">

						<p:outputLabel value="Email" />
						<p:inputText value="#{mbCliente.cliente.email}" />

						<p:outputLabel value="Senha" />
						<p:password
						
						
						 value="#{mbCliente.cliente.senha}" />
					</p:panelGrid>
					<br />
					<br />
					<p:commandButton value="Compra" action="#{mbCliente.comprar}"
						ajax="false" />
					<br />
					<br />
					<p:commandButton value=" Cancelar Compra"
						action="#{mbCliente.sair}" />

				</p:tab>

				<p:tab title="Ainda Nao Possui Cadastro">

					<p:panelGrid columns="2">

						<p:outputLabel value="Nome:" />
						<p:inputText value="#{mbCliente.clienteNew.nome}" />

						<p:outputLabel value="Email:" />
						<p:inputText value="#{mbCliente.clienteNew.email}" />

						<p:outputLabel value="Senha:" />
						<p:password id="senha1" match="senha2"
							validatorMessage="Senha não conferem"
							 />

						<p:outputLabel value="Confirme Senha:" />
						<p:password value="#{mbCliente.clienteNew.senha}" id="senha2" />

					</p:panelGrid>

					<br />
					<br />

					<p:commandButton value="Realizar Cadastro  e confirma Compra"
						action="#{mbCliente.cadastrar}" ajax="false" />

					<p:commandButton value=" Cancelar Compra"
						action="#{mbCliente.sair}" />

				</p:tab>

			</p:tabView>




		</p:panel>



	</h:form>



</h:body>

	
</html>